package com.wilson.treeviewer.model;

import java.util.List;

public class UserTree {

    private final UserNode root;

    public UserTree() {
        User rootUser = new User();
        rootUser.setId("root");
        rootUser.setUsername("root");
        root = new UserNode(rootUser);
    }

    public UserTree(List<UserNode> nodes) {
        this();

        for (UserNode node : nodes) {
            if (node.getParentNode() == null) {
                root.addChild(node);
            }
        }
    }

    public UserNode getRoot() {
        return root;
    }

}
